const i18n = require('i18n');

cc.Class({
    extends: cc.Component,

    properties: {
        lbl_name: {
            default: null,
            type: cc.Label
        },
        lbl_money: {
            default: null,
            type: cc.Label
        },
        spr_icon:{
            default:null,
            type: cc.Sprite,
        },
        txt_info:{
            default:null,
            type: cc.RichText,
        },
        item_ID: 0,
        item_price: 0,
        item_name: "",
    },
    
    onLoad: function () {
        this.node.on('touchend', function () {
            console.log("Item " + this.item_ID + ' clicked');
        }, this);
    },

    updateItem: function(itemId) {
        this.item_ID = itemId;
        this.txt_info.string = "<color=#00ff00>Item</c><color=#ff0000>"+itemId+"</color>";
        this.lbl_money.string = itemId * itemId;
        this.lbl_name.string = "Name-"+itemId;
    },
});
